Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add cypress test to bulk select #1314

Merged

Conversation

opacut
Copy link
Contributor

@opacut opacut commented Dec 9, 2024

Description

Associated Jira ticket: RHINENG-14744

Add Cypress test to Bulk Selector

How to test the PR

run npm test:ct

Before the change

90 tests are run

After the change

At least 91 tests are run, including The Bulk selector shows the correct number of systems selected.

Dependent work link

Checklist:

  • The commit message has the Jira ticket linked
  • PR has a short description
  • Screenshots before and after the change are added
  • Tests for the changes have been added
  • README.md is updated if necessary
  • Needs additional dependent work

@opacut opacut requested a review from a team as a code owner December 9, 2024 12:32
src/SmartComponents/SystemAdvisor/SystemAdvisor.cy.js Outdated Show resolved Hide resolved
src/SmartComponents/SystemAdvisor/SystemAdvisor.cy.js Outdated Show resolved Hide resolved

// select a couple
// but only ones that can be selected
cy.get('.pf-v5-c-table__tbody').then(rows => {selectRandomEnabledRows({rows: rows, numberOfRowsToSelect: 3})});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
cy.get('.pf-v5-c-table__tbody').then(rows => {selectRandomEnabledRows({rows: rows, numberOfRowsToSelect: 3})});
cy.get(TABLE).then(rows => selectRandomEnabledRows({rows: rows, numberOfRowsToSelect: 3}));

https://github.com/RedHatInsights/frontend-components/blob/master/packages/utils/src/TestingUtils/CypressUtils/selectors.js#L18

Copy link
Contributor Author

@opacut opacut Dec 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one doesn't work - the test gets stuck

cy.get(':nth-child(2) > .pf-v5-c-menu-toggle').should('have.text', '3 selected')

// Select None
cy.get(':nth-child(2) > .pf-v5-c-menu-toggle > .pf-v5-c-menu-toggle__controls').click();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use PT_BULK_SELECT from FEC to select the bulk select toggle

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PT_BULK_SELECT results in a flaky test. I think it's because it targets the pf-v5-c-menu-toggle element, instead of the pf-v5-c-menu-toggle__controls element. In some cases it then doesn't open the BS menu

src/SmartComponents/SystemAdvisor/SystemAdvisor.cy.js Outdated Show resolved Hide resolved
@johnsonm325
Copy link
Contributor

Your errors are for linting. npm run lint should give you everything you need.

Copy link

codecov bot commented Jan 10, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 22.22%. Comparing base (c54aca3) to head (b24429c).
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1314   +/-   ##
=======================================
  Coverage   22.22%   22.22%           
=======================================
  Files          96       96           
  Lines        2560     2560           
  Branches      811      811           
=======================================
  Hits          569      569           
  Misses       1991     1991           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@johnsonm325 johnsonm325 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rebase to the base branch and you're good to go!

@LightOfHeaven1994
Copy link
Contributor

/retest

@LightOfHeaven1994 LightOfHeaven1994 merged commit 574d02e into RedHatInsights:master Jan 14, 2025
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants